In a communications system, channel encoding is usually used to improve data transmission reliability, to ensure communication quality. A Polar code proposed by Turkish professor Arikan is the first good code that has been theoretically proved to be capable of achieving a Shannon capacity and that has low encoding and decoding complexity. The polar code is a linear block code. An encoding matrix of the polar code is GN, and an encoding process of the polar code is x1N=u1NGN, where u1N=(u1, u2, . . . , uN) is a binary row vector whose length is N (namely, a mother code length), GN is an N×N matrix, GN=F2⊗(log2(N)), and F2⊗(log2(N)) is defined as a Kronecker product of log2N matrices F2.
The matrix F2 is:
      F    2    =            [                                    1                                0                                                1                                1                              ]        .  
In the encoding process of the polar code, some bits in u1N are used to carry information and are referred to as information bits, and a set of indexes of these bits is denoted as A. Other bits are set to a fixed value pre-agreed on by a receiving device (referred to as receiving end hereinafter) and a transmitting device (referred as transmitting end hereinafter), and are referred to as fixed bits or frozen bits. A set of indexes of these bits is represented by Ac. Ac is a complementary set of A. The encoding process of the polar code is equivalent to:x1N=UAGN(A)⊕uAcGN(AC).
Herein, GN(A) is a submatrix of GN and that is obtained based on rows corresponding to the indexes in the set A, and GN(Ac) is a submatrix of GN and that is obtained based on rows corresponding to the indexes in the set Ac. uA is a set of the information bits in u1N, and a quantity of the information bits is K. uAc is a set of the fixed bits in u1N, and a quantity of the fixed bits is (N−K). The fixed bits are known bits. These fixed bits are usually set to 0. However, the fixed bits can be set to any value provided that the value is pre-agreed on by the receiving end and the transmitting end. When the fixed bits are set to 0, an encoding output of the polar code may be simplified as:x1N=uAGN(A),in which GN(A) is a K×N matrix.
A polar code construction process is a process of selecting the set A. This determines performance of the polar code. The polar code construction process is usually: determining, based on the mother code length N, that there are a total of N polar channels respectively corresponding to N rows of the encoding matrix, calculating reliabilities of the polar channels, using indexes of the first K polar channels with relatively high reliabilities as elements in the set A, and using indexes of remaining (N−K) polar channels as elements in the index set Ac of the fixed bits. Positions of the information bits are determined based on the set A, and positions of the fixed bits are determined based on the set Ac.
It can be learned from the encoding matrix that a code length N of an original polar code (a mother code) is an integer power of 2, and in actual applications, a polar code with any code length is obtained by performing a rate matching on the mother code.
Currently, there are three rate matching schemes for the polar code: puncturing, shortening, and repetition. In the first two schemes, it is determined that a mother code length N, which is an integer power of 2, is greater than a target code length M, puncturing or shortening positions are determined according to a preset rule, and encoded bits at corresponding positions are removed, so as to achieve a rate matching. Before decoding, log-likelihood ratio (LLR) at the corresponding positions is restored according to a predetermined rule, to implement de-rate matching.
In order to achieve a balance between encoding performance and complexity, a repetition-based rate matching scheme may be determined, according to an agreed rule, for use in a communications system. A polar code encoded by using a mother code length is repeated to obtain a target code length that is greater than the mother code length, thereby implementing rate matching of the polar code. A difference of repetition from puncturing or shortening lies in that, an encoded bit sequence having the mother code length is repeatedly sent in a specific order until the target code length is reached, to implement rate matching. At a decoder side, LLRs at repetition positions are superimposed to implement de-rate matching, and decoding is performed by using the determined mother code length. Rate matching implemented in a repetition manner can lower decoding complexity, and reduce latency and a hardware implementation area. However, in some cases, repetition causes a particular performance loss to the polar code.